package com.sina.microblog.data
{
	import mx.utils.ObjectUtil;
	
	
	/**
	 * MicroBlogComment是一个数据封装类(Value Object)，该类代表对一条微博的评论
	 */ 	
	public class MicroBlogComment
	{
		/**
		 *  创建评论的时间
		 */  	
		public var createdAt:Date;
		/**
		 * 评论的id
		 */ 
		public var id:String;
		public var idstr:String;
		public var mid:String;
		
		/**
		 * 评论来源
		 */ 
		public var source:String;
		
		/**
		 * 评论的内容
		 */ 
		public var text:String;
		/**
		 * 评论的作者
		 */ 
		public var user:MicroBlogUser;
		/**
		 * 该条评论所针对的微博
		 */ 
		public var status:MicroBlogStatus;
		/**
		 * 该条评论所针对的微博回复
		 */ 
		public var replyComment:MicroBlogComment;

		/**
		 * @private
		 */ 
		public function MicroBlogComment(comment:Object)
		{
			this.idstr = comment["idstr"];
			this.createdAt = MicroBlogDataUtil.resolveDate(comment.created_at);
			this.id = comment["id"];
			this.mid = comment["mid"];
			this.source = comment["source"];
			this.text = comment["text"];
			
			if(comment.status){
				this.status = new MicroBlogStatus(comment.status);
			}
			
			if(comment.user){
				this.user = new MicroBlogUser(comment.user);
			}
			
			if(comment.reply_comment){
				this.replyComment = new MicroBlogComment(comment.reply_comment);
			}
			
		}

	}
}